﻿using CNKI.TPI.Web.Interface.Models;
using CNKI.TPI.Web.Search.IBLL;
using CNKI.TPI.Web.Search.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace CNKI.TPI.Web.Interface.Controllers
{
    public class ValuesController : ApiController
    {
        private IUserService userService = null;

        public ValuesController(IUserService userService)
        {
            this.userService = userService;
        }
        // GET api/values
        public IEnumerable<string> Get()
        {
            return new string[] { "value1", "value2" };
        }

        // GET api/values/5
        public object Get(string usercode)
        { 
            
            LoginUserInfo userInfo = userService.ValidateUser(usercode, "", false);
            OutputEntity outobj = new OutputEntity();
            outobj.data = userInfo;
            outobj.Status = Status.Success;
            return outobj;
        }

        // POST api/values
        public void Post([FromBody]string value)
        {   
        }

        // PUT api/values/5
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE api/values/5
        public void Delete(int id)
        {
        }
    }
}